package com.ruoyi.system.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

@ApiModel(value = "DeptUserTree", description = "用户实体")
public class DeptUserTree implements Serializable {

    @ApiModelProperty("ID")
    private Long id;

    @ApiModelProperty("ID")
    private String label;

    @ApiModelProperty("唯一性ID")
    private String unikey;

    @ApiModelProperty("是否禁用：true 禁用无法点击选择；false 能选择。")
    private boolean disabled;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<DeptUserTree> children;

    public DeptUserTree() {
    }

    public DeptUserTree(SysUser user)
    {
        this.id = user.getUserId();
        this.label = user.getUserName();
        this.unikey = "user-" + user.getUserId();
        this.disabled = false;
    }

    public DeptUserTree(SysDept dept)
    {
        this.id = dept.getDeptId();
        this.label = dept.getDeptName();
        this.unikey = "dept-" + dept.getDeptId();
        this.disabled = true;
    }
    public DeptUserTree(TreeSelect dept)
    {
        this.id = dept.getId();
        this.label = dept.getLabel();
        this.unikey = "dept-" + dept.getId();
        this.disabled = true;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<DeptUserTree> getChildren() {
        return children;
    }

    public void setChildren(List<DeptUserTree> children) {
        this.children = children;
    }

    public String getUnikey() {
        return unikey;
    }

    public void setUnikey(String unikey) {
        this.unikey = unikey;
    }

    public boolean isDisabled() {
        return disabled;
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
